//
//  XYComposeEmoticonView.swift
//  WeiboSourceCode
//
//  Created by 周星宇 on 16/1/6.
//  Copyright © 2016年 cn.weibo. All rights reserved.
//

import UIKit

class XYComposeEmoticonView: UICollectionView {

    override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
        super.init(frame: frame, collectionViewLayout: UICollectionViewFlowLayout())
        setUpUI()
    }
    private func setUpUI() {
    
        
        let layout = collectionViewLayout as! UICollectionViewFlowLayout
        // 水平滚动
        layout.scrollDirection = .Horizontal
        // 设置 cell 之前的间距
        layout.minimumInteritemSpacing = 0
        layout.minimumLineSpacing = 0
        // 开启分页
        pagingEnabled = true
        // 关闭滚动条
        showsHorizontalScrollIndicator = false
        // 关闭弹簧效果
        bounces = false
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        let layout = collectionViewLayout as! UICollectionViewFlowLayout
        layout.itemSize = CGSizeMake(kSCREENWITH, self.frame.size.height)
        
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}


